<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Esign extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'esign';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'card_type_text',
        'status_text'
    ];
    

    
    public function getCardTypeList()
    {
        return ['CRED_PSN_CH_IDCARD' => __('Card_type CRED_PSN_CH_IDCARD'), 'CRED_PSN_CH_TWCARD' => __('Card_type CRED_PSN_CH_TWCARD'), 'CRED_PSN_CH_MACAO' => __('Card_type CRED_PSN_CH_MACAO'), 'CRED_PSN_PASSPORT' => __('Card_type CRED_PSN_PASSPORT'), 'CRED_PSN_CH_GREEN_CARD' => __('Card_type CRED_PSN_CH_GREEN_CARD'), 'CRED_PSN_UNKNOWN' => __('Card_type CRED_PSN_UNKNOWN')];
    }

    public function getStatusList()
    {
        return ['wait' => __('Status wait'), 'over' => __('Status over'), 'fail' => __('Status fail')];
    }


    public function getCardTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['card_type']) ? $data['card_type'] : '');
        $list = $this->getCardTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
